<script>
	layui.use(['form', 'layer','upload'], function () {
		var form = layui.form, $ = layui.jquery, upload = layui.upload;
		//单图上传
		upload.render({
			elem: "{{ $adBtn }}",
			url: "{{ $url }}",
			data:{'_token':$('meta[name="csrf-token"]').attr('content')},
			done: function(res){
				if(res.status == 1){
					$("{{ $image_id }}").val(res.image_id);
					$("{{ $adPic }}").html('<dd class="upload-icon-img" ><div class="upload-pre-item"><i onclick="delete_img(this)"   class="layui-icon"></i><a class="example-image-link" href="' + res.url+ ' " data-lightbox="example-set" data-title=""><img src="' + res.url + '" class="img" /></a></div></dd>');
					layer.msg(res.msg,{time:1000,icon:1});
				}else{
					layer.msg(res.error,{time:2000,icon:2});
				}
			}
		});
		delete_img = function(obj){
			$(obj).parent().parent().parent().parent().parent().parent().children('input').val('');
			$(obj).parent().parent().parent().html('');
		}
	});
</script>